package com.xinsoft.jobs;

import com.xinsoft.service.CusUpkeepPlanService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @ClassName UpKeepJob
 * @Description 保养计划生成保养工单定时任务
 * @Author lijie
 * @Date 2023/6/25 9:20 星期日
 * @Version 1.0
 */
@Slf4j
@EnableScheduling
@Component
public class UpKeepPlanJob {

    private static CusUpkeepPlanService planService;

    @Autowired
    public void setCusUpkeepPlanService(CusUpkeepPlanService planService) {
        UpKeepPlanJob.planService = planService;
    }

    /**
     * @Author Li9527
     * @Description 保养计划定期生成执行
     * @Date 2023/6/25 9:23
     * @params
     * @return void
     **/
//    @Scheduled(cron = "0 0/1 * * * ?")
    @Scheduled(cron = "0 50 23 * * ?")
    private void planToTask() {
        // 巡检计划定期生成执行
        planService.planToTask();
    }


    /**
     * @Author Li9527
     * @Description 保养执行-定时处理待处理未处理的保养执行为超时未处理
     * @Date 2023/7/12 14:09
     * @return void
     **/
    @Scheduled(cron = "0 59 23 * * ?")
    private void upKeepChangeToTimeOut() {
        // 巡检计划定期生成执行
        planService.upKeepChangeToTimeOut();
    }

    /**
     * @Author Li9527
     * @Description 巡检执行-定时处理待处理未处理的保养执行为超时未处理
     * @Date 2023/7/12 14:11
     * @return void
     **/
    @Scheduled(cron = "0 59 23 * * ?")
    private void patrolChangeToTimeOut() {
        // 巡检计划定期生成执行
        planService.patrolChangeToTimeOut();
    }
}
